package com.lmb.service.impl;

import com.lmb.bean.Houses;
import com.lmb.bean.Houses;
import com.lmb.mapper.HousesDao;
import com.lmb.service.HousesService;
import com.lmb.util.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class HousesServiceImpl implements HousesService {
    @Autowired
    HousesDao housesDao;

    @Override
    public Houses add(Houses houses) {
        housesDao.add(houses);
        Houses result=housesDao.one(houses.getHouse_id());
        return result;
    }

    @Override
    public Houses edit(Houses houses) {
        housesDao.edit(houses);
        Houses result=housesDao.one(houses.getHouse_id());
        return result;
    }

    @Override
    public int del(Integer id) {
        return housesDao.del(id);
    }

    @Override
    public Houses one(Integer id) {
        return housesDao.one(id);
    }

    @Override
    public List<Houses> all(Houses houses) {

        return housesDao.all(houses);
    }

    @Override
    public void page(Page page, Houses houses) {
        int count= housesDao.pageCount(houses);
        Object data= housesDao.page(page, houses);
        page.setCount(count);
        page.setData(data);
    }
}
